home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / The Weakest Link / source / SortFrames.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-23  |  1.1 KB  |  55 lines

  1.  
  2. #include <MacTypes.h>
  3.  
  4. typedef struct {
  5.     // no ethernet header; please remove it first.
  6.     // IP Header:
  7.     UInt8    versionAndIHL;
  8.     UInt8    typeOfService;
  9.     UInt16    totalLength;
  10.     UInt32    ip1;
  11.     UInt8    timeToLive;
  12.     UInt8    protocol;
  13.     UInt16    headerChecksum;
  14.     UInt32    sourceIP;
  15.     UInt32    destIP;
  16.     
  17.     // udp header
  18.     UInt16    srcPort;
  19.     UInt16    dstPort;
  20.     UInt16    messageLength;
  21.     UInt16    checksum;
  22.     
  23.     // data
  24.     UInt8    data[36];            // optional data
  25.     
  26. } Packet;
  27.  
  28. // Generic message descriptor
  29. struct msg_descriptor {
  30.     UInt8*    data;    // pointer to buffer containing message
  31.     UInt32    size;    // size of message in buffer
  32.     UInt16    offset;    // offset to next item in message
  33. };
  34. typedef struct msg_descriptor msg_descriptor_t;
  35.  
  36. #define kMaxResponseLen    1460
  37. // DNS request (collect DNS message information)
  38. struct dns_request {
  39.     msg_descriptor_t md;
  40.     UInt16    remotePort;
  41.     UInt32    remoteAddr;
  42.     // data buffer
  43.     UInt8    buf[kMaxResponseLen];
  44. };
  45. typedef struct dns_request dns_request_t;
  46.  
  47.  
  48. OSErr createStash(void);
  49. void destroyStash(void);
  50.  
  51. void ConsumePacket( Packet *packet, UInt32 inSize );
  52. int InitializeResponses();
  53. void CleanupResponses();
  54. Boolean GetDName(msg_descriptor_t* md, Str255 outStr);
  55.